package com.im.common;

import java.util.HashMap;
import java.util.Map;

/**
 * @author gongym
 * @date 2019/1/9 14:34
 */
public class Constants {
  public static final String USER_AUTHORITY = "USER_AUTHORITY";
  public static final String BASIC = "Basic ";
  public static final long TO_SERVER = 0;
  public static final long TO_USER = -1;

  /** 标志位，是否存在 */
  public static final Integer IS_EXIST = 1;

  public static final Integer IS_NOT_EXIST = 0;
  /** 确认为好友 */
  public static final Integer IS_CONFIRM = 1;
  /** 临时好友 */
  public static final Integer IS_NOT_CONFIRM = 0;
  /** 最大协议包长度 */
  public static final int MAX_FRAME_LENGTH = 1024 * 10;

  public static final int MAX_AGGREGATED_CONTENT_LENGTH = 65536;
  public static final Map<Long, String> MESSAGE_HANDLE_MAP =
      new HashMap<Long, String>() {
        private static final long serialVersionUID = -5375196188311409645L;

        {
          // 发送给服务器
          put(TO_SERVER, "ServerMessageServiceImpl");
          // 发送给其他用户
          put(TO_USER, "UserMessageServiceImpl");
        }
      };

  /** 自定义报文类型 */
  public static class CommandType {
    /** 登录 */
    public static final int LOGIN = 1;
    /** 业务消息 */
    public static final int MESSAGE = 2;
    /** ping */
    public static final int PING = 3;
  }
}
